home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3501 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.7 KB  |  57 lines

  1. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
  2. Path: blackbush.xlink.net!slsv6bt!slsv6bt!kanze
  3. From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
  4. Subject: Undefined behavior? on type conversion, was: Re: Hungarian notation
  5. In-Reply-To: miker3@ix.netcom.com's message of Wed, 24 Jan 1996 12:37:05 GMT
  6. Message-ID: <KANZE.96Jan24152858@slsvewt.lts.sel.alcatel.de>
  7. Sender: news@lts.sel.alcatel.de
  8. Organization: SEL
  9. References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl>
  10.     <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca>
  11.     <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com>
  12.     <3104bfc8.132251392@nntp.ix.netcom.com> <dewar.822407919@schonberg>
  13.     <3106260f.224013120@nntp.ix.netcom.com>
  14. Date: 24 Jan 1996 14:28:58 GMT
  15.  
  16. In article <3106260f.224013120@nntp.ix.netcom.com>
  17. miker3@ix.netcom.com (Mike Rubenstein) writes:
  18.  
  19. |> dewar@cs.nyu.edu (Robert Dewar) wrote:
  20.  
  21. |> > Michael says (talking about overflow in C)
  22. |> > 
  23. |> > "An implementation must handle this and must document how it does so."
  24. |> > 
  25. |> > Yes, of course the documentation may say that the result is to delete
  26. |> > your system disk. Even if a more reasonable behavior is described, any
  27. |> > program relying on such an implementation dependent feature is of
  28. |> > course compromising its portability. One of the troubles with C is
  29. |> > that it is oh-so-easy to introduce implementation dependence.
  30. |> > 
  31. |> > It is interesting to note that a number of "bug" reports sent into gcc
  32. |> > are complaints that GCC does not duplicate some implementation
  33. |> > dependent behavior seen in some other compiler.
  34.  
  35. |> Is it really necessary to post this kind of nonsense.  No, the
  36. |> documentation may not say the result is to delete your system disk.
  37. |> Repeating the quote from ISO 6.2.1.2
  38.  
  39. |>     When a value with integral type is demoted to a signed integer
  40. |>     with smaller size or an unsigned integer is converted to its 
  41. |>     corresponding signed integer, if the value cannot be 
  42. |>     represented the result is implementation defined.
  43.  
  44. |> This requires an implementation to convert the integral type.  It does
  45. |> not give it license to take actions not specified by the standard.
  46.  
  47. Does it?  I believe that it was the intent of the authors that the
  48. `result' of the conversion could be a signal (for example) or a core
  49. dump.  (This is, of course, the only reasonable thing for an
  50. implementation to do.)
  51. --
  52. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  53. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  54. Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
  55.                 -- A la recherche d'une activitΘ dans une region francophone
  56.  
  57.